//群成员表


// 1.引入mongoose模块
const mongoose = require('mongoose');
const MemberSchema = new mongoose.Schema({
    // 群id
    groupId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Group'
    },

    //用户id
    userId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User',
    },

    //群昵称
    name: {
        type: String,
    },

    // 加入时间
    time: {
        type: Date,
        default: new Date()
    },


    // 未读消息数
    num: {
        type: Number,
        default: 0
    },

    // 是否屏蔽群消息
    shield: {
        type: Boolean,
        default: false
    }
})


// 3.根据规则创建集合
const Member = mongoose.model('Member', MemberSchema);


// 4.将集合做为模块成员进行导出
module.exports = Member
